package com.headingdata.d3_inner_class3;

public class Test2 {
    public static void main(String[] args) {
        Swimming s = new Dog();
        go(s);

        Swimming s1 = new Swimming() {
            @Override
            public void swim() {
                System.out.println("小明会自由泳！");
            }
        };
        go(s1);

        go(new Swimming() {
            @Override
            public void swim() {
                System.out.println("小红会蛙泳！");
            }
        });

    }
    public static void go(Swimming s){
        System.out.println("=======================开始");
        s.swim();
    }


}

class Dog implements Swimming{

    @Override
    public void swim() {
        System.out.println("狗狗游的可快了~~~");
    }
}


interface Swimming{
    void swim();
}
